package com.xsz.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xsz.entity.User;
import com.xsz.service.UserService;

@RestController
public class UserController {
	@Resource
	UserService userService;
	
	@RequestMapping("register")
	public User register(User user) {
		 return userService.add(user);
	}
	
	
	@RequestMapping("all")
	public List<User> showAll() {
		 return userService.getAll();
	}
	
	
	@RequestMapping("login")
	public User login(User user) {
		 return userService.login(user.getName(), user.getPwd());
	}
	
	@RequestMapping("like")
	public List<User> showNameLike(User user) {
		 return userService.likeName(user.getName());
	}
	

}
